package ProjectManagement;

import java.sql.Connection;
import java.sql.DriverManager;

public class DobConn {
    /**
     * 获取连接方法
     *
     * @return
     */

    public static Connection getConn() {
        Connection conn = null;
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://lainhavenohair.icu:3306/spm?useUnicode=true&characterEncoding=UTF-8", "database_spm_3", "developer@SPM_3");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }
    public static Connection getConn1() {
        Connection conn = null;
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/messageborad?useSSL=false","root","root");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }
    public static void main(String[] args) {
        try {
            if(DobConn.getConn()==null){
                System.out.println("出错");
            }else{
                System.out.println("测试");
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

